Automatic compass calibration systems and methods

ABSTRACT

Techniques are disclosed for systems and methods to provide automatic and substantially continuous calibration for compasses mounted to moving structures. A compass calibration system may include a logic device configured to receive one or more sensor signals and determine a corrected magnetic field based, at least in part, on a measured local magnetic field. The logic device may be adapted to receive an angular velocity, an acceleration, the measured local magnetic field, and/or a speed of a mobile structure; generate stabilized roll and pitch components of an orientation of the mobile structure based, at least in part, on the acceleration and angular velocity; and determine the corrected magnetic field based, at least in part, on the speed, the local magnetic field, the stabilized roll and pitch components, and/or the angular velocity.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of International Patent Application No. PCT/US2014/038286 filed May 15, 2014 and entitled “AUTOMATIC COMPASS CALIBRATION SYSTEMS AND METHODS” which claims the benefit of and priority to U.S. Provisional Patent Application No. 61/823,903 filed May 15, 2013 and entitled “AUTOMATIC COMPASS CALIBRATION SYSTEMS AND METHODS,” and U.S. Provisional Patent Application No. 61/823,906 filed May 15, 2013 and entitled “AUTOMATIC COMPASS CALIBRATION SYSTEMS AND METHODS,” which are hereby incorporated by reference in their entirety.

TECHNICAL FIELD

One or more embodiments of the invention relate generally to compass calibration and more particularly, for example, to systems and methods for automatic compass calibration and providing accurate headings.

BACKGROUND

The earth's magnetic field has long been used to provide a reference from which to estimate headings and plan routes. Typically, a compass is used to measure the local magnetic field, and the earth's magnetic field is either assumed to be equal to the local field or is estimated from the local measurement using a combination of relatively manual factory calibration and user calibration processes. For example, a factory calibration method might include application of external fields in a controlled environment, and a user calibration method might include slowing rotating the compass through a planned series of maneuvers (e.g., providing another type of controlled environment).

These conventional calibration methods require time and/or expensive equipment to implement, and calibrations reached using these methods can rapidly become inaccurate or produce inaccurate headings during relatively uncontrolled motion and other short and long term changing environmental conditions, particularly when the earth's magnetic field includes a relatively large vertical component. GPS based systems have been developed that estimate headings from differential position data, but these types of systems are typically very inaccurate over short linear distances or quick changes in heading. Thus, there is a need for an improved methodology to address compass calibration that provides reliable heading information through a variety of changing environmental conditions.

SUMMARY

Techniques are disclosed for systems and methods to provide automatic compass calibration for heading sensors mounted to moving platforms.

In one embodiment, a system includes a logic device configured to receive one or more sensor signals and determine a corrected magnetic field based, at least in part, on a measured local magnetic field. The logic device may be adapted to receive an angular velocity, an acceleration, the measured local magnetic field, and/or a speed of a mobile structure; generate stabilized roll and pitch components of an orientation of the mobile structure based, at least in part, on the acceleration and angular velocity; and determine the corrected magnetic field based, at least in part, on the speed, the local magnetic field, the stabilized roll and pitch components, and/or the angular velocity.

In another embodiment, a method includes receiving an angular velocity, an acceleration, a measured local magnetic field, and/or a speed of a mobile structure; generating stabilized roll and pitch components of an orientation of the mobile structure based, at least in part, on the acceleration and angular velocity; and determining a corrected magnetic field based, at least in part, on the speed, the local magnetic field, the stabilized roll and pitch components, and/or the angular velocity.

The scope of the invention is defined by the claims, which are incorporated into this section by reference. A more complete understanding of embodiments of the invention will be afforded to those skilled in the art, as well as a realization of additional advantages thereof, by a consideration of the following detailed description of one or more embodiments. Reference will be made to the appended sheets of drawings that will first be described briefly.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates a block diagram of a compass calibration system in accordance with an embodiment of the disclosure.

FIG. 2 illustrates a diagram of a compass calibration system in accordance with an embodiment of the disclosure.

FIG. 3 illustrates a graph of magnetic fields in accordance with an embodiment of the disclosure.

FIG. 4 illustrates a graph of magnetic fields in accordance with an embodiment of the disclosure.

FIG. 5 illustrates a graph of magnetic fields in accordance with an embodiment of the disclosure.

FIG. 6 illustrates graphs of a cost function in accordance with embodiments of the disclosure.

FIG. 7A illustrates a flow diagram of various operations to provide compass calibration in accordance with an embodiment of the disclosure.

FIG. 7B illustrates a flow diagram of various operations to provide compass calibration in accordance with an embodiment of the disclosure.

FIG. 7C illustrates a flow diagram of various operations to provide compass calibration in accordance with an embodiment of the disclosure.

FIGS. 8-18 illustrate flow diagrams of various operations to provide compass calibration in accordance with embodiments of the disclosure.

FIGS. 19A-C illustrate software code of various operations to provide compass calibration in accordance with embodiments of the disclosure.

FIGS. 20A-C illustrate software code of various operations to provide compass calibration in accordance with embodiments of the disclosure.

FIGS. 21A-B illustrate software code of various operations to provide compass calibration in accordance with embodiments of the disclosure.

FIGS. 22A-C illustrate software code of various operations to provide compass calibration in accordance with embodiments of the disclosure.

FIGS. 23A-B illustrate software code of various operations to provide compass calibration in accordance with embodiments of the disclosure.

FIGS. 24-25 illustrate software code of various operations to provide compass calibration in accordance with embodiments of the disclosure.

Embodiments of the invention and their advantages are best understood by referring to the detailed description that follows. It should be appreciated that like reference numerals are used to identify like elements illustrated in one or more of the figures.

DETAILED DESCRIPTION

In accordance with various embodiments of the present disclosure, automatic compass calibration systems and methods may advantageously include a magnetometer in conjunction with a gyroscope and accelerometer providing measurements of angular velocities and linear accelerations of a mobile structure disposed within a magnetic field measured by the magnetometer. For example, the accelerometer and/or gyroscope may be mounted to or within the mobile structure, or may be integrated with the magnetometer. By selectively correlating angular velocity and acceleration measurements with measurements of a local magnetic field, embodiments of the present disclosure can quickly develop a robust, accurate, and adaptable calibration parameter space without the need for a manually controlled calibration environment. Such calibration space may be used to compensate for fixed and/or movable hard and/or soft iron disturbances to the local magnetic field.

To explain further, a compass is subject to errors introduced by the local magnetic environment. Where the local magnetic disturbance is part of the structure to which the compass is mounted, it is possible to correct for the disturbance. For many years, ship's compasses were corrected only for hard iron disturbance by placing a weak compensating magnet sufficiently close to the compass to cancel the ship's hard iron magnetics. Subsequently, Lord Kelvin invented soft iron correction for iron clad ships, placing a pair of “Kelvin's balls” to either side of the binnacle, at a distance adjusted to compensate for the effect of the iron, which was guiding the earth's magnetism fore-aft, creating a N—S magnet along the fore aft axis of the ship.

Since the advent of the electronic ship's compass, it has been possible to electronically correct for hard and soft iron. The user is required to press a button, and then circle the ship through 360°. The resulting field then traces a portion of a spherical surface in space, offset from the origin by the hard iron distortion, and squashed from a sphere into an ellipsoid by the soft iron distortion. The maneuver is done in calm water with the ship upright, and the correction is in 2 dimensions (conventionally, there is no visibility of any vertical hard or soft iron distortion). If the ship heels or pitches, the resulting error is not corrected. Additionally, it has not been possible to run an automatic compass correction continuously because a ship's motion at sea disturbs the gimbal, which introduces further correction errors, and because there has been no way to separate the combined effects of 2D and 3D error signals.

More recently, nine-axis hardware has eliminated the gimbal and made it possible to perform a rough 3D correction. However it has not been possible to do this continuously because of the difficulties involved in obtaining a sufficiently rich data set and in processing the data to correctly determine the disturbing field parameters. So, users have still been required to press a button and perform a circle. This invention substantially eliminates the need for user intervention, and obtains a continuous compass calibration/correction.

FIG. 1 illustrates a block diagram of a compass calibration system 100 in accordance with an embodiment of the disclosure. In the embodiment shown in FIG. 1, system 100 may be implemented to provide compass calibration for a particular type of mobile structure 101, such as a smart phone, a terrestrial robot, an aerial drone, a motorboat, a sailboat, an automobile, an airplane, and/or other types of mobile structures. System 100 may also be implemented to provide automatic compass calibration for a variety of other types of mobile platforms including a compass or other device used to measure magnetic fields.

In one embodiment, system 100 may include one or more of a magnetometer 110 (e.g., physically coupled to, integrated with, and/or otherwise fixed relative to accelerometer 242 and gyroscope 240 through use of a housing or other structure of compass 210 and/or mobile structure 101), a gyroscope 240, an accelerometer 242, a user interface 114, a controller 130, and one or more other sensors and/or actuators, such as a global positioning satellite system (GPS) 116, a speed sensor 118, a steering sensor/actuator 250, and/or other modules 260. In some embodiments, each of magnetometer 110, gyroscope 240, accelerometer 242 and/or controller 130 may be implemented in a combined housing or structure, referred to as compass 210. In further embodiments, one or more components of system 100 may be implemented within a common housing.

In various embodiments, system 100 may be adapted to measure local magnetic field 106 (e.g., three dimensional direction and magnitude), which may be influenced by hard iron disturbance 220 and/or soft iron disturbance 222, and corresponding environmental conditions. System 100 may then use these measurements to determine a corresponding corrected magnetic field 108 (e.g., three dimensional direction and magnitude) and/or heading angle 109, for example, that accurately and adaptively compensates for hard iron disturbance 220, soft iron disturbance 222, and/or other motion and/or orientation related disturbances influencing local magnetic field 106. In various embodiments, corrected magnetic field 108 may correspond to the Earth's magnetic field, measured at the position of magnetometer 110. System 100 may be adapted to calibrate compass 210 without necessitating a manually controlled calibration environment.

Directions 102, 103, and 104 describe one possible coordinate frame of compass 210 (e.g., of magnetic fields measured by magnetometer 110, accelerations measured by accelerometer 242, and/or angular velocities measured by gyroscope 240). As shown in FIG. 1, direction 102 illustrates a direction that may be substantially parallel to and/or aligned with a longitudinal axis of mobile structure 101 and/or compass 210, direction 103 illustrates a direction that may be substantially parallel to and/or aligned with a lateral axis of mobile structure 101 and/or compass 210, and direction 104 illustrates a direction that may be substantially parallel to and/or aligned with a vertical axis of mobile structure 101 and/or compass 210, as described herein. The various directions may describe one possible coordinate frame of mobile structure 101.

For example, a roll component of motion of compass 210 and/or mobile structure 101 may correspond to rotations around direction 102, a pitch component may correspond to rotations around direction 103, and a yaw component may correspond to rotations around direction 104. Heading angle 109 may correspond to the angle between a projection of corrected magnetic field 108 onto a horizontal plane (e.g., referenced to a gravitationally defined “down” vector) and a projection of direction 102 onto the same horizontal plane. In some embodiments, the projection of corrected magnetic field 108 onto a horizontal plane (e.g., referenced to a gravitationally defined “down” vector) may be referred to as Magnetic North. In various embodiments, Magnetic North, a “down” vector, and/or various other directions, positions, and/or fixed or relative reference frames may define an absolute coordinate frame, for example, where directional measurements referenced to an absolute coordinate frame may be referred to as absolute directional measurements (e.g., an “absolute” magnetic field, or an “absolute” orientation).

Each of magnetometer 110, gyroscope 240, accelerometer 242, user interface 114, GPS 116, speed sensor 118, controller 130, steering sensor/actuator 250, and one or more other modules 260 may be implemented with any appropriate logic device (e.g., processing device, microcontroller, processor, application specific integrated circuit (ASIC), field programmable gate array (FPGA), memory storage device, memory reader, or other device or combinations of devices) that may be adapted to execute, store, and/or receive appropriate instructions, such as software instructions implementing a method for providing automatic compass calibration, for example, or for transmitting and/or receiving communications, such as sensor signals, sensor information, and/or control signals, between one or more devices of system 100. In one embodiment, such method may include instructions to determine corrected magnetic field 108 from various sensor signals, determine heading 109 from corrected magnetic field 108, and/or determine calibration parameters for determining corrected magnetic field 108, for example, as described herein. In a further embodiment, such method may include instructions for forming one or more communication links between various devices of system 100.

In addition, one or more machine readable mediums may be provided for storing non-transitory instructions for loading into and execution by any logic device implemented with one or more of the devices of system 100. In these and other embodiments, the logic devices may be implemented with other components where appropriate, such as volatile memory, non-volatile memory, and/or one or more interfaces (e.g., inter-integrated circuit (I2C) interfaces, mobile industry processor interfaces (MIPI), joint test action group (JTAG) interfaces (e.g., IEEE 1149.1 standard test access port and boundary-scan architecture), and/or other interfaces, such as an interface for one or more antennas, or an interface for a particular type of sensor).

Each of magnetometer 110, gyroscope 240, accelerometer 242, user interface 114, GPS 116, speed sensor 118, controller 130, steering sensor/actuator 250, and one or more other modules 260 may be implemented with one or more amplifiers, modulators, phase adjusters, beamforming components, digital to analog converters (DACs), analog to digital converters (ADCs), various interfaces, antennas, and/or other analog and/or digital components enabling each of the devices of system 100 to transmit and/or receive signals, for example, in order to facilitate wired and/or wireless communications between one or more devices of system 100. Such components may be integrated with a corresponding device of system 100, for example. In some embodiments, the same or similar components may be used to perform one or more sensor measurements, as described herein.

Sensor signals, control signals, and other signals may be communicated among devices of system 100 using a variety of wired and/or wireless communication techniques, including voltage signaling, Ethernet, WiFi, Bluetooth, Zigbee, Xbee, Micronet, or other medium and/or short range wired and/or wireless networking protocols and/or implementations, for example. In such embodiments, each device of system 100 may include one or more modules supporting wired, wireless, and/or a combination of wired and wireless communication techniques.

Magnetometer 110 may be implemented as one or more suspended magnets, hall effect magnetometers, magnetoresistive devices, fluxgate magnetometers, semiconductor-based magnetometers, and/or other device capable of measuring magnetic fields (e.g., magnitude and direction, relative to a position, orientation, and/or motion of magnetometer 110, compass 210, and/or mobile structure 101) substantially local to magnetometer 110 and/or mobile structure 101 and providing such measurements as sensor signals communicated to various devices of system 100. As noted herein, magnetometer 110 may be implemented with an antenna, a logic device, and/or other analog and/or digital components enabling magnetometer 110 to provide, receive, and process sensor signals and communicate with one or more devices of system 100. Further, a logic device of magnetometer 110 may be adapted to perform any of the methods described herein.

Gyroscope 240 may be implemented as an electronic sextant, semiconductor device, integrated chip, or other device capable of measuring angular velocities of magnetometer 110, compass 210, and/or mobile structure 101 and providing such measurements as sensor signals that may be communicated to other devices of system 200 (e.g., user interfaces 114, controller 130). Gyroscope 240 may be adapted to measure angular velocities in relation to a coordinate frame of magnetometer 110 (e.g., a coordinate frame of the magnetic fields measured by magnetometer 110).

Accelerometer 242 may be implemented as one or more accelerometer sensors, accelerometer sensor systems, and/or other devices capable of measuring linear accelerations (e.g., direction and magnitude) of magnetometer 110, compass 210, and/or mobile structure 101, and providing such measurements as sensor signals communicated to various devices of system 100. Accelerometer 242 may be adapted to measure accelerations in relation to a coordinate frame of magnetometer 110 (e.g., a coordinate frame of the magnetic fields measured by magnetometer 110).

As shown in FIG. 1, accelerometer 242 may be located substantially near, on, or within a housing for compass 210. In some embodiments, accelerometer 242 may be integrated with compass 210 and/or magnetometer 110, for example, or may be integrated onto a printed circuit board (PCB) of compass 210 to reduce system complexity, manufacturing costs, power requirements, and/or timing errors between measurements of magnetic fields and accelerations. For example, magnetometer 110 and accelerometer 242 may be configured to share one or more components, such as a memory, a logic device, a communications module, and/or other components, and such sharing may act to reduce and/or substantially eliminate such timing errors while reducing overall system complexity and/or cost.

In various embodiments, a logic device (e.g., of magnetometer 110, accelerometer 242, and/or other devices of system 100) may be adapted to determine parameters (e.g., using signals from various devices of system 100) for transforming a coordinate frame of accelerometer 242 and/or gyroscope 240 to/from a coordinate frame of magnetometer 110, a coordinate frame of mobile structure 101, at-rest and/or in-motion, and/or other coordinate frames, as described herein. One or more logic devices of system 100 may be adapted to use such parameters to transform a coordinate frame of accelerometer 242 to/from a coordinate frame of magnetometer 110 and/or mobile structure 101, for example. Furthermore, such parameters may be used to determine and/or calculate one or more adjustments to an orientation of accelerometer 242 that would be necessary to physically align a coordinate frame of accelerometer 242 with a coordinate frame of magnetometer 110 and/or mobile structure 101. Adjustments determined from such parameters may be used to selectively power adjustment servos (e.g., of compass 210), for example, or may be communicated to a user through user interface 114, as described herein.

User interface 114 may be implemented as a display, a touch screen, a keyboard, a mouse, a joystick, a knob, a steering wheel, a ship's wheel, a yolk, and/or any other device capable of accepting user input and/or providing feedback to a user. In various embodiments, user interface 114 may be adapted to provide user input (e.g., as a type of signal and/or sensor information) to other devices of system 100, such as magnetometer 110 and/or controller 130.

User interface 114 may be implemented with one or more logic devices that may be adapted to execute instructions, such as software instructions, implementing any of the various processes and/or methods described herein. For example, user interface 114 may be adapted to form communication links, transmit and/or receive communications (e.g., sensor signals, control signals, sensor information, user input, and/or other information), determine corrected magnetic fields, adjust positions and/or orientations of compass 210, determine parameters for one or more coordinate frame transformations, and/or perform coordinate frame transformations, for example, or to perform various other processes and/or methods.

In various embodiments, user interface 114 may be adapted to accept user input, for example, to form a communication link, to select a particular wireless networking protocol and/or parameters for a particular wireless networking protocol and/or wireless link (e.g., a password, an encryption key, a MAC address, a device identification number, a device operation profile, parameters for operation of a device, and/or other parameters), to select a method of processing sensor signals to determine sensor information, to adjust a position and/or orientation of compass 210, and/or to otherwise facilitate operation of system 100 and devices within system 100. Once user interface 114 accepts a user input, the user input may be transmitted to other devices of system 100 over one or more communication links.

In one embodiment, user interface 114 may be adapted to receive a sensor signal (e.g., from magnetometer 110 and/or accelerometer 242) over communication links formed by one or more associated logic devices, for example, and display sensor information corresponding to the received sensor signal to a user. In related embodiments, user interface 114 may be adapted to process sensor signals to determine sensor information. For example, a sensor signal may include a magnetic field, an angular velocity, and/or an acceleration of mobile structure 101. In such embodiment, user interface 114 may be adapted to process the sensor signals to determine sensor information indicating a motion compensated acceleration of mobile structure 101, for example, and/or indicating stabilized roll and pitch components of an orientation of mobile structure 101.

In some embodiments, user interface 114 may be adapted to accept user input including a user-defined heading for mobile structure 101, for example, and to generate control signals for steering sensor/actuator 250 to cause mobile structure 101 to steer towards the user-defined heading. More generally, user interface 114 may be adapted to display sensor information to a user, for example, and/or to transmit sensor information and/or user input to other user interfaces, sensors, or controllers of system 100, for instance, for display and/or further processing.

GPS 116 may be implemented as a global positioning satellite receiver and/or other device capable of determining absolute and/or relative position of mobile structure 101 based on wireless signals received from space-born and/or terrestrial sources, for example, and capable of providing such measurements as sensor signals that may be communicated to various devices of system 100. In some embodiments, GPS 116 may be adapted to determine a velocity of mobile structure 101 (e.g., using a series of position measurements), such as an absolute velocity of mobile structure 101. In various embodiments, one or more logic devices of system 100 may be adapted to determine a speed of mobile structure 101 from such velocity.

Speed sensor 118 may be implemented as an electronic pitot tube, metered gear or wheel, water speed sensor, wind speed sensor, and/or other device capable of measuring a linear speed of mobile structure 101 (e.g., in a surrounding medium and/or aligned with a longitudinal axis of mobile structure 101) and providing such measurements as sensor signals communicated to various devices of system 100.

As noted herein, GPS 116 and/or speed sensor 118 may be implemented with antennas, logic devices, and/or other analog and/or digital components enabling GPS 116 and/or speed sensor 118 to interface with, provide signals, receive signals, and otherwise communicate with one or more devices of system 100.

Controller 130 may be implemented as any appropriate logic device (e.g., processing device, microcontroller, processor, application specific integrated circuit (ASIC), field programmable gate array (FPGA), memory storage device, memory reader, or other device or combinations of devices) that may be adapted to execute, store, and/or receive appropriate instructions, such as software instructions implementing a control loop for controlling various operations of compass 210 and/or mobile structure 101, for example. Such software instructions may also implement methods for processing sensor signals, determining sensor information, providing user feedback (e.g., through user interface 114), querying devices for operational parameters, selecting operational parameters for devices, or performing any of the various operations described herein (e.g., operations performed by logic devices of various devices of system 100).

In addition, a machine readable medium may be provided for storing non-transitory instructions for loading into and execution by controller 130. In these and other embodiments, controller 130 may be implemented with other components where appropriate, such as volatile memory, non-volatile memory, one or more interfaces, and/or various analog and/or digital components for interfacing with devices of system 100. For example, controller 130 may be adapted to store sensor signals, sensor information, parameters for coordinate frame transformations, calibration parameters, sets of calibration points, and/or other operational parameters, over time, for example, and provide such stored data to a user using user interface 114. In some embodiments, controller 130 may be integrated with one or more user interfaces (e.g., user interface 114), and, in one embodiment, may share a communication module or modules. As noted herein, controller 130 may be adapted to execute one or more control loops for steering control (e.g., through steering actuator 250), collision avoidance, and/or performing other various operations of mobile structure 101. In some embodiments, a control loop may include processing sensor signals and/or sensor information in order to control one or more operations of mobile structure 101.

Steering sensor/actuator 250 may be adapted to sense and/or physically adjust a steering mechanism for mobile structure 101 according to one or more control signals (e.g., a steering demand) provided by controller 130. Steering sensor/actuator 250 may be physically coupled to a rudder or other type of steering mechanism of mobile structure 101, for example, and may be adapted to physically adjust the rudder to a variety of positive and/or negative steering angles.

Other modules 260 may include other and/or additional sensors, actuators, communications modules/nodes, and/or user interface devices used to provide additional environmental information of mobile structure 101, for example. In some embodiments, other modules 260 may include a humidity sensor, a wind and/or water temperature sensor, a barometer, a radar system, a visible spectrum camera, an infrared camera, and/or other environmental sensors providing measurements and/or other sensor signals that can be displayed to a user and/or used by other devices of system 200 (e.g., controller 130) to provide operational control of mobile structure 101 that compensates for environmental conditions, such as wind speed and/or direction, swell speed, amplitude, and/or direction, and/or an object in a path of mobile structure 101, for example.

Each device of system 100 may include one or more batteries or other electrical power storage devices, for example, and may include one or more solar cells or other electrical power generating devices (e.g., a wind or water-powered turbine, or a generator producing electrical power from motion of one or more components of system 100). In some embodiments, one or more of the devices may be powered by a power source for mobile structure 101, using one or more power leads.

By locating magnetometer 110, accelerometer 242, and gyroscope 240 near or within compass 210, embodiments of the present disclosure provide measurements of accelerations and angular velocities of magnetometer 110 and/or compass 210 that are accurate substantially to the limit of accuracy of the accelerometer and gyroscope used to implement accelerometer 242 and gyroscope 240, respectively. Further, magnetic field measurements may be made, transmitted, and/or stored at substantially the same time and/or using substantially the same components as those used for acceleration and/or angular velocity measurements, thus substantially eliminating errors due to measurement timing mismatches. For example, in one embodiment, a logic device of compass 210 may be adapted to provide measurements of magnetic fields, angular velocities, and accelerations as sensor signals communicated to various devices of system 100. Conventional methods to overcome measurement timing errors, particularly in real-time, typically require substantial increases in system complexity and/or power usage related to increasing communication bandwidths and/or sensor sampling rates. Thus, embodiments of the present disclosure provide substantial benefits over conventional systems in terms of increased accuracy, lower system complexity, lower power requirements, and lower overall cost.

FIG. 2 illustrates a diagram of a compass calibration system 200 in accordance with an embodiment of the disclosure. In the embodiment shown in FIG. 2, system 200 may be implemented to provide automatic compass calibration for mobile structure 101, similar to system 100 of FIG. 1. For example, system 200 may include compass 210 (e.g., magnetometer 110, gyroscope 240, accelerometer 242), user interface/controller 114/130, steering sensor/actuator 250, and various other sensors and/or actuators. In the embodiment illustrated by FIG. 2, mobile structure 101 is implemented as a sail boat including a hull 270, a deck 272, a mast 274, and a rudder 276. In other embodiments, hull 270, deck 272, mast 274, and rudder 276 may correspond to attributes of a passenger automobile or other type of vehicle, robot, or drone, for example, such as an undercarriage, a passenger compartment, an engine compartment, a trunk, a roof, a steering mechanism, and/or other portions of a vehicle.

In one embodiment, user interface 114 may be mounted to mobile structure 101 substantially on deck 272 and/or mast 274. Such mount may be fixed, for example, or may include gimbals and other leveling mechanisms so that a display of user interface 114 stays substantially level with respect to a horizon and/or a “down” vector. In another embodiment, user interface 114 may be located in proximity to mobile structure 101 and be mobile throughout a user level (e.g., deck 272) of mobile structure 101. For example, user interface 114 may be implemented with a lanyard and/or other type of strap and/or attachment device and be physically coupled to a user of mobile structure 101 so as to be in proximity to mobile structure 101. In various embodiments, user interface 114 may be implemented with a relatively thin display that is integrated into a PCB of the corresponding user interface in order to reduce size, weight, housing complexity, and/or manufacturing costs.

As shown in FIG. 2, in some embodiments, speed sensor 118 may be mounted to a portion of mobile structure 101 substantially below a typical user level, such as to hull 270, and be adapted to measure a relative water speed. Speed sensor 118 may be adapted to provide a thin profile to reduce and/or avoid water drag. Speed sensor 118 may include one or more batteries and/or other electrical power storage devices, for example, and may include one or more water-powered turbines to generate electrical power. In other embodiments, speed sensor 118 may be powered by a power source for mobile structure 101, for example, using one or more power leads penetrating hull 270.

In the embodiment illustrated by FIG. 2, mobile structure 101 includes direction/longitudinal axis 102, direction/lateral axis 103, and direction/vertical axis 104 meeting approximately at mast 274 (e.g., near a center of gravity of mobile structure 101). In one embodiment, the various axes may define a coordinate frame of mobile structure 101 and/or compass 210. Each sensor device adapted to measure a direction (e.g., velocities, accelerations, magnetic fields, or other states including a directional component) may be implemented with a mount, actuators, and/or servos that can be used to align a coordinate frame of the sensor device with a coordinate frame of any device of system 100 and/or mobile structure 101. Each device may be located at positions different from those depicted in FIG. 2. Each device of system 200 may include one or more batteries or other electrical power storage devices, for example, and may include one or more solar cells or other electrical power generating devices. In some embodiments, one or more of the devices may be powered by a power source for mobile structure 101.

FIGS. 3-5 illustrate the types of magnetic fields and disturbances experienced by typical mobile structures including a compass.

FIG. 3 illustrates a graph 300 of magnetic fields in accordance with an embodiment of the disclosure. Graph 300 shows plot 310 including a number of measurements of a local magnetic field influenced by hard and soft iron disturbances, as illustrated by offset ellipsoid 312 (e.g., plot 310 is substantially on the surface of offset ellipsoid 312). Plot 320 includes a similar number of measurements of a local magnetic field with no hard or soft disturbances, as illustrated by centered sphere 322, such that the local magnetic field substantially corresponds to the earth's magnetic field and/or a corrected magnetic field. Measurements corresponding to plots 310 and 320 were made by a compass (e.g., and corresponding mobile structure) experiencing substantially no roll or pitch. Notably, plots 310 and 320 are both substantially ring-shaped.

Eight offset ellipsoid parameters characterizing ellipsoid 312 may be determined. Applying the inverse of the parameters then straightens and centers the ellipsoid gives a corrected magnetic vector. However, in practice, the typical least squares adjustment process is ill conditioned for a typical data set that can realistically be collected from a ship. An ideal data set would contain 360° of yaw, 360° of roll and 360° of pitch, and with such a data set, existing methods would indeed work. Whilst it is easy to obtain a real data set with 360° of yaw, pitch and roll are often limited to 10°. As can be seen from FIG. 3, many ellipsoids could provide an apparently good fit to plot 310; there is no single right answer or reliably attainable global minimum in a conventional characterization process. Indeed, a similar example is provided in FIG. 4 for a case with real-world roll and pitch, and there is still no clear characterization because the data set is insufficiently rich.

FIG. 4 illustrates a graph 400 of magnetic fields in accordance with an embodiment of the disclosure. Graph 400 shows plot 410 including a number of measurements of a local magnetic field influenced by hard and soft iron disturbances, as illustrated by offset ellipsoid 412. Plot 420 includes a similar number of measurements of a local magnetic field with no hard or soft disturbances, as illustrated by centered sphere 422. Measurements corresponding to plots 410 and 420 were made by a compass (e.g., and corresponding mobile structure) experiencing substantially no roll or pitch. Notably, neither of plots 410 and 420 are ring-shaped, and neither provide a data set rich enough to reliably determine calibration parameters between plot 410 and 420. Put differently, the difference between the two plots is not clear enough to drive a least squares algorithm reliably to the correct answer, given that real data contains noise, has limited precision, and is limited in quantity by available system memory, computational power, time, and other system resources.

To create a practical algorithm, the magnetic vector should be roll and pitch corrected, and the subsequent data should be fit to an appropriately determined ring rather than to a shell. FIG. 5 provides the same set of measurements in FIG. 4, but after roll and pitch correction. FIG. 5 illustrates a graph 500 of magnetic fields in accordance with an embodiment of the disclosure. Graph 500 shows plot 510 including a number of measurements of a local magnetic field influenced by hard and soft iron disturbances, but roll and pitch corrected. Plot 520 includes a similar number of measurements of a local magnetic field with no hard or soft disturbances, as illustrated by centered sphere 522, also roll and pitch corrected. Notably, both plots 510 and 520 are substantially ring-shaped.

Thus, from FIGS. 3-5, a more reliable shape to fit a selection of disturbed magnetic field data to is a circle centered on the origin, where all points lie as close as possible to a circle (which can have any particular radius or height). Put differently, the variance of the height and radius of the points must be minimized. For very far north/south locations where the earth's field is almost vertical, or for mobile structures where the disturbing field is very large (e.g., larger than the horizontal component of the earth's magnetic field), the uncorrected circle no longer encloses the origin (as shown). In this case, minimizing the vertical and radial variance is not enough, and so it is also useful to ensure that the circle is centered close to the origin. An appropriately constructed cost function can ensure such limitations. Once constructed, the cost function can be minimized (e.g., using a least squares method, such as that disclosed herein) to provide the appropriate calibration parameters for an offset vector H and stretch/compress matrix S that can be combined with the uncorrected measured local magnetic field to produce a corrected magnetic field.

The vertical terms of the offset vector H and stretch/compress matrix S (e.g., H3 and S33) are almost always ill-conditioned in any practical ship motion scenario at extreme northern/southern latitudes, and so, in some embodiments, a further term may be used to prevent wild vertical correction parameters developing which is (H3^2 S33^2). It is then possible to construct a robust cost function, i.e. one which provides a clear ‘downhill direction’ for least squared adjustment, substantially globally.

FIG. 6 illustrates graphs 600 of a cost function in accordance with embodiments of the disclosure. In FIG. 6, an appropriate cost function is shown for increasingly difficult data sets. The ideal data set is top left, uniform and complete with 360° of yaw data evenly distributed. Top right, the data set is not uniform, i.e. there are more points collected on some headings than on others. Bottom left there are only 180° of yaw data available, and bottom right there are only 90° of yaw data available. Notably, each graph shows a relatively pronounced global minimum, and this global minimum can be reached relatively reliably without a need to a controlled calibration environment, as shown.

As can be seen from FIG. 6, ring fitting is extremely successful under less than optimum conditions, and can still benefit from rich and accurate data sets even though they aren't required to reach an accurate calibration. In some embodiments, data measurements may occur at approximately 100 Hz (e.g., or as low 10 Hz or as high as 500 Hz, depending on system resources), and so there typically are vast quantities of data available. Because data storage capacity may be limited, it is typically important to only store calibration points (e.g., and/or their corresponding environmental state variables) that are sufficiently accurate and contribute to enriching the data set. Lack of accuracy can arise when the external magnetic environment is temporarily corrupted by nearby metal objects (e.g., lock's, steel ships) or other environmental changes (the vessel travels across the globe).

In some embodiments, new calibration points are stored only when the magnetic field is sufficiently different from the last point stored. This can be a 5 dimensional comparison including the local magnetic field (in vector form) and the corresponding roll and pitch components of the mobile structure or compass. In other embodiments, new calibration points are stored only when the magnetic field's rate of change is consistent with the gyroscope inferred boat motion (i.e. there are no significant external field variations) and the boat speed is at or around cruising speed. In further embodiments, new calibration points are stored according to a particular combination of the above and/or according to other external and internal conditions, as described herein. In some embodiments, new calibration points overwrite old points which are close by so as to limit the use of memory. In still further embodiments, points may be aged so that no point survives for more than approximately 60 minutes, the time it takes to move into a significantly different magnetic environment whilst circumnavigating the globe at 40 kts, or for a shorter or longer time period set by a user.

FIGS. 7A-C illustrate flow diagrams of respective processes 700, 710, 720 to provide automatic compass calibration for compass 210 of mobile structure 101 in accordance with embodiments of the disclosure. In some embodiments, the operations of FIGS. 7A-C may be implemented as software instructions executed by one or more logic devices associated with corresponding electronic devices and/or sensors of system 100 of FIG. 1 and/or system 200 of FIG. 2. More generally, the operations of FIGS. 7A-C may be implemented with any combination of software instructions and/or electronic hardware (e.g., inductors, capacitors, amplifiers, or other analog and/or digital components).

It should be appreciated that any step, sub-step, sub-process, or block of processes 700, 710, 720 may be performed in an order or arrangement different from the embodiments illustrated by respective FIGS. 7A-C. For example, in other embodiments, one or more blocks may be omitted from the various processes, and blocks from one process may be included in another process. Furthermore, block inputs, block outputs, various sensor signals, sensor information, calibration parameters, and/or other operational parameters may be stored to one or more memories of systems 100 and/or 200 prior to moving to a following portion of a corresponding process. Although processes 700, 710, 720 are described with reference to systems 100 and 200, processes 700, 710, 720 may be performed by other systems different from systems 100 and 200 and including a different selection of electronic devices, sensors, mobile structures, and/or mobile structure attributes.

Process 700 may represent a process for determining a corrected magnetic field from various sensor signals. In block 701, controller 130 receives an angular velocity, an acceleration, a local magnetic field, and/or a speed of mobile structure 101.

In block 702, controller 130 preprocesses the received sensor data. For example, a logic device of controller 130 may be adapted to range and/or slew rate limit the sensor signals received in block 701.

In block 703, controller 130 generates a motion compensated acceleration. For example, a logic device of controller 130 may be adapted to use the speed and derived yaw rates to compensate the accelerations and eliminate artifacts of fore/aft and turning acceleration on pitch and roll.

In block 704, controller 130 generates a debiased angular velocity. For example, a logic device of controller 130 may be adapted to use magnetic fields and accelerations to remove a DC bias from the gyroscope-derived angular velocities.

In block 705, controller 130 generates stabilized roll and pitch components of an orientation of the mobile structure. For example, a logic device of controller 130 may be adapted to determine gyroscope stabilized pitch and roll components from the accelerations instead of integrating the gyroscope-derived angular velocities and accumulating various calculation errors.

In block 706, controller 130 determines a corrected magnetic field from the speed, local magnetic field, stabilized roll and pitch components, and/or the angular velocity. For example, a logic device of controller 130 may be adapted to accumulate selected calibration points and perform a ring fit process, as described herein, to reliably and adaptively determine calibration parameters without requiring a controlled calibration environment.

Process 710 may represent a process for determining a stabilized heading for mobile structure 101. In block 711, controller 130 generate a raw heading from stabilized roll and pitch components of an orientation of mobile structure 101 and/or a magnetic field (e.g., local magnetic field 106 and/or corrected magnetic field 108). For example, a logic device of controller 130 may be adapted to project the magnetic fields onto a horizontal plane defined by stabilized roll and pitch components.

In block 712, controller 130 generates a corrected angular velocity of the mobile structure from a debiased angular velocity, the raw heading, and/or the stabilized roll and pitch components, as described herein. In block 713, controller 130 determines a stabilized heading from the raw heading and corrected angular velocity, as described herein. In block 714, controller 130 generates corresponding control signals for a steering actuator, as described herein.

Process 720 may represent a process for determining calibration parameters for compass 210, as described herein. In block 721, controller 130 determines whether external conditions corresponding to received sensor data are appropriate for performing a calibration process, as described herein. In block 722, controller 130 determines that internal conditions corresponding to a set of prior calibration points are appropriate to store a calibration point corresponding to the received sensor data, as described herein. In block 723, controller 130 stores the calibration point. In block 724, controller 130 determines, from the set of prior calibration points and/or the calibration point, calibration parameters to determine the corrected magnetic field, as described herein.

FIGS. 8-18 illustrate flow diagrams and/or control loops of respective processes 800-1800 to provide automatic compass calibration for compass 210 of mobile structure 101 in accordance with embodiments of the disclosure. In some embodiments, the operations of FIGS. 8-18 may be implemented as software instructions executed by one or more logic devices associated with corresponding electronic devices and/or sensors of system 100 of FIG. 1 and/or system 200 of FIG. 2. More generally, the operations of FIGS. 8-18 may be implemented with any combination of software instructions and/or electronic hardware (e.g., inductors, capacitors, amplifiers, or other analog and/or digital components).

It should be appreciated that any step, sub-step, sub-process, or block of processes 800-1800 may be performed in an order or arrangement different from the embodiments illustrated by respective FIGS. 8-18. For example, in other embodiments, one or more blocks and/or elements may be omitted from the various processes, and blocks and/or elements from one process may be included in another process. Furthermore, inputs, outputs, various sensor signals, sensor information, calibration parameters, and/or other operational parameters, constants, state variables or other information may be stored to one or more memories of systems 100 and/or 200 prior to moving to a following portion of a corresponding process. Although processes 800-1800 are described with reference to systems 100 and 200, processes 800-1800 may be performed by other systems different from systems 100 and 200 and including a different selection of electronic devices, sensors, mobile structures, and/or mobile structure attributes.

Process 800 of FIG. 8 illustrates a top level view of a compass calibration process. In some embodiments, process 800 may include sensor inputs 810 (e.g., from gyroscope 240, accelerometer 242, magnetometer 110, speed sensor 118, and/or user interface 114), logic block 820 (e.g., expanded upon in FIGS. 9-18), and/or outputs 830 (e.g., estimate orientations and angular velocities, and corrected magnetic fields).

Process 900 of FIG. 9 illustrates an intermediate level view of a compass calibration process. In some embodiments, process 900 may correspond to logic block 820 in FIG. 8 and may include range and slew limiters 910 (e.g., applicable to the various sensor inputs), logic block 912 to provide motion compensated accelerations, logic block 914 to provide debiased angular velocities, logic block 916 to provide stabilized roll and pitch components of an orientation of compass 210 and/or mobile structure 101, logic block 918 to provide corrected magnetic fields 930, logic block 920 to provide headings of mobile structure 101 (e.g., using projections of corrected magnetic fields 930 onto stabilized horizontal planes), logic block 922 to determine corrected angular velocities of compass 210 and/or mobile structure 101, logic block 924 to provide stabilized headings, and/or selective inverters 926 to compensate for positive or negative vertical accelerations.

Process 1000 of FIG. 10 illustrates an intermediate level view of a compass calibration process. In some embodiments, process 1000 may correspond to logic block 912 in FIG. 9. In the embodiment shown, process 1000 provides motion compensation for accelerations due to roll experienced by compass 210 and/or mobile structure 101. In further embodiments, process 1000 may be adapted to include similar processes to compensate for motion corresponding to pitch experienced by compass 210 and/or mobile structure 101.

Process 1100 of FIG. 11 illustrates an intermediate level view of a compass calibration process. In some embodiments, process 1100 may correspond to logic block 924 in FIG. 9. In the embodiment shown, process 1100 provides stabilized headings from raw headings and corrected angular velocities.

Process 1200 of FIG. 12 illustrates an intermediate level view of a compass calibration process. In some embodiments, process 1200 may correspond to logic blocks 910 in FIG. 9. In the embodiment shown, process 1100 provides range and rate limiting of an input sensor signal.

Process 1300 of FIG. 13 illustrates an intermediate level view of a compass calibration process. In some embodiments, process 1300 may correspond to logic block 926 in FIG. 9. In the embodiment shown, process 1300 inverts pitch and yaw components depending on a sign of a vertical acceleration.

Process 1400 of FIG. 14 illustrates an intermediate level view of a compass calibration process. In some embodiments, process 1400 may correspond to logic block 914 in FIG. 9. In the embodiment shown, process 1400 provides debiased angular velocities by correcting raw angular velocities from gyroscope 240 using calculated angular velocities derived from accelerations from accelerometer 242 and magnetic fields (e.g., local magnetic fields and/or corrected magnetic fields) in logic block 1410.

Process 1500 of FIG. 15 illustrates an intermediate level view of a compass calibration process. In some embodiments, process 1500 may correspond to logic block 1410 in FIG. 14. In the embodiment shown, process 1500 provides stabilized headings from raw headings and corrected angular velocities. In some embodiments, process 1500 may include logic block 1510 to determine intermediate roll and pitch components from accelerations, logic block 1512 to determine an intermediate heading of compass 210 and/or mobile structure 101 by projecting magnetic fields on a horizontal plane defined by the intermediate roll and pitch components, and/or block 1514 to determine an intermediate angular velocity from the intermediate roll and pitch components and the intermediate heading.

Process 1600 of FIG. 16 illustrates an intermediate level view of a compass calibration process. In some embodiments, process 1600 may correspond to logic block 918 in FIG. 9. In various embodiments, process 1600 may include logic block 1610 to determine if external conditions are appropriate to perform a calibration process, logic block 1612 to determine if internal conditions are appropriate to store a new calibration point, and/or logic block 1620 to apply calibration parameters to local magnetic fields to generate corrected magnetic fields 1630.

Process 1700 of FIG. 17 illustrates an intermediate level view of a compass calibration process. In some embodiments, process 1700 may correspond to logic block 1610 in FIG. 16. In various embodiments, process 1700 may include flow 1710 to determine if a speed is in an appropriate range, flow 1720 to determine if the conditions are satisfactory for a period of time, flow 1730 to determine if a gyroscope-derived yaw rate is within a particular range, and/or flow 1740 to determine if a ratio of a magnetic field-derived yaw rate (squared) to the gyroscope-derived yaw rate (squared) is in a particular range. Process 1700 may include logic block 1710 to provide a roll and pitch corrected magnetic field, logic block 1744 to determine a square of the magnetic field-derived yaw rate, and/or block 1746 to adjust the ratio limit based on the status of a corresponding cost function.

Process 1800 of FIG. 18 illustrates an intermediate level view of a compass calibration process. In some embodiments, process 1800 may correspond to logic block 1744 in FIG. 17. In various embodiments, process 1600 may determine a square of a magnetic field-derived yaw rate.

In some embodiments, gyroscope-derived angular velocities can be compared to magnetic field-derived angular velocities to detect magnetic disturbances. Once detected, calibration point storage can be locked out. In various embodiments, achieving a coherent, well distributed, memory efficient “mag/roll/pitch/age” data set may be accomplished by: ageing over 60 minutes to allow self-consistency during world-wide navigation, adding a new point only when it is far enough (in a 5d sense) from the prior point, and/or overwriting the least useful point once memory is full. In other embodiments, maintaining stability of the vertical correction may be accomplished by locking out adjustments to the H3 and S33 terms when vertical variance in the database of points is low. In some embodiments, the system may be configured to achieve a compromise between robustness to temporary disturbance to the ship's magnetic field and rapid adaptation to a permanent disturbance (e.g. a fire extinguisher or other metal object in the vicinity of the compass is repositioned) through the use of Active and Candidate parameters. Further details of example implementations according to one or more embodiments may be found in the attached diagrams and software implementations.

For example, FIGS. 19A-C illustrate embodiments of software code portions 1916, 1920, and 1922 implementing respective operations 916, 920, and 922 of FIG. 9, and FIGS. 20A-C illustrate embodiments of software code portions 2010, 2012, and 2014 implementing respective operations 1510, 1512, and 1514 of FIG. 15. FIGS. 21A-B illustrate an embodiment of a software code portion (split into portions 2112A and 2112B in FIGS. 21A and 21B) implementing operation 1612 of FIG. 16, and FIGS. 21A-C illustrate an embodiment of a software code portion (split into portions 2214A, 2214B, and 2214C in FIGS. 22A, 22B, and 22C) implementing operation 1614 of FIG. 16. Additionally, FIG. 22B includes function call 2280 configured to execute a subroutine illustrated in FIGS. 23A-B.

FIGS. 23A-B illustrate an embodiment of a software code portion (split into portions 2314A and 2314B in FIGS. 23A and 23B) implementing a ring fitting routine. As noted herein, in some embodiments, software code portion 2314A-B may be executed as a subroutine to software code portion 2214A-C. FIG. 24 illustrates an embodiment of a software code portion 2420 implementing operation 1620 of FIG. 16, and FIG. 25 illustrates an embodiment of a software code portion 2542 implementing operation 1742 of FIG. 17.

Because the various processes described herein provide and/or utilize a highly accurate automatic compass calibration system, embodiments may be implemented to provide stabilized headings reliable enough to form the basis for a safe and accurate piloting control system, as described herein. Furthermore, where physical access to at least a portion of the automatic compass calibration system is restricted and/or limited, due to positioning of a compass relative to a mobile structure and/or the remoteness of a robot or drone to manual intervention, for example, the reduced operational power usage evidenced in embodiments of the present disclosure substantially increases the long-term utility and overall convenience of the system.

Where applicable, various embodiments provided by the present disclosure can be implemented using hardware, software, or combinations of hardware and software. Also where applicable, the various hardware components and/or software components set forth herein can be combined into composite components comprising software, hardware, and/or both without departing from the spirit of the present disclosure. Where applicable, the various hardware components and/or software components set forth herein can be separated into sub-components comprising software, hardware, or both without departing from the spirit of the present disclosure. In addition, where applicable, it is contemplated that software components can be implemented as hardware components, and vice-versa.

Software in accordance with the present disclosure, such as non-transitory instructions, program code, and/or data, can be stored on one or more non-transitory machine readable mediums. It is also contemplated that software identified herein can be implemented using one or more general purpose or specific purpose computers and/or computer systems, networked and/or otherwise. Where applicable, the ordering of various steps described herein can be changed, combined into composite steps, and/or separated into sub-steps to provide features described herein.

Embodiments described above illustrate but do not limit the invention. It should also be understood that numerous modifications and variations are possible in accordance with the principles of the invention. Accordingly, the scope of the invention is defined only by the following claims. 

What is claimed is:
 1. A system comprising: a logic device configured to receive one or more sensor signals and determine a corrected magnetic field based, at least in part, on a measured local magnetic field, wherein the logic device is adapted to: receive an angular velocity, an acceleration, the measured local magnetic field, and/or a speed of a mobile structure; generate stabilized roll and pitch components of an orientation of the mobile structure based, at least in part, on the acceleration and angular velocity; and determine the corrected magnetic field based, at least in part, on the local magnetic field and the stabilized roll and pitch components.
 2. The system of claim 1, wherein: the stabilized roll and pitch components define a stabilized horizontal plane; the logic device is adapted to determine a heading of the mobile device based, at least in part, on a projection of the corrected magnetic field onto the stabilized horizontal plane; and the determined heading is relatively insensitive to signal artifacts in yaw-rate components of the received angular velocity.
 3. The system of claim 1, wherein the acceleration comprises a motion compensated acceleration of the mobile structure based, at least in part, on the received acceleration and/or the angular velocity.
 4. The system of claim 1, wherein the angular velocity comprises a debiased angular velocity of the mobile structure based, at least in part, on the received angular velocity and/or the acceleration.
 5. The system of claim 1, wherein the logic device is adapted to: generate a raw heading based, at least in part, on the stabilized roll and pitch and/or the corrected magnetic field; generate a corrected angular velocity of the mobile structure based, at least in part, on a debiased angular velocity of the mobile structure, the raw heading, and/or the stabilized roll and pitch; and determine a stabilized heading based, at least in part, on the raw heading and the corrected angular velocity.
 6. The system of claim 5, wherein the logic device is adapted to generate control signals for a steering actuator corresponding to a difference between a user-defined heading and the stabilized heading.
 7. The system of claim 1, wherein the determining the corrected magnetic field is additionally based on the speed and/or the angular velocity, and wherein the logic device is adapted to: determine that external conditions corresponding to the angular velocity, the acceleration, the measured local magnetic field, and/or the speed of the mobile structure are appropriate for performing a calibration process; determine that internal conditions corresponding to a set of prior calibration points are appropriate to store a calibration point corresponding to the angular velocity, the acceleration, the measured local magnetic field, and/or the speed of the mobile structure; store the calibration point; and determine, from the set of prior calibration points and/or the calibration point, calibration parameters to determine the corrected magnetic field.
 8. The system of claim 1, further comprising a user interface, wherein the logic device is adapted to receive user input from the user interface corresponding to a user-defined heading, and wherein the logic device is configured to display the user-defined heading and/or the corrected magnetic field using the user interface.
 9. The system of claim 8, further comprising a magnetometer, wherein the logic device, the user input, and the magnetometer are implemented within a common housing.
 10. The system of claim 1, wherein the mobile structure comprises a smart phone, a terrestrial robot, an aerial drone, a motorboat, a sailboat, an automobile, and/or an airplane.
 11. A method comprising: receiving an angular velocity, an acceleration, a measured local magnetic field, and/or a speed of a mobile structure; generating stabilized roll and pitch components of an orientation of the mobile structure based, at least in part, on the acceleration and angular velocity; and determining a corrected magnetic field based, at least in part, on the local magnetic field and the stabilized roll and pitch components.
 12. The method of claim 11, wherein: the stabilized roll and pitch components define a stabilized horizontal plane; the method further comprises determining a heading of the mobile device based, at least in part, on a projection of the corrected magnetic field onto the stabilized horizontal plane; and the determined heading is relatively insensitive to signal artifacts in yaw-rate components of the received angular velocity.
 13. The method of claim 11, wherein the acceleration comprises a motion compensated acceleration of the mobile structure based, at least in part, on the received acceleration and/or the angular velocity.
 14. The method of claim 11, wherein the angular velocity comprises a debiased angular velocity of the mobile structure based, at least in part, on the received angular velocity and/or the acceleration.
 15. The method of claim 11, comprising: generating a raw heading based, at least in part, on the stabilized roll and pitch and/or the corrected magnetic field; generating a corrected angular velocity of the mobile structure based, at least in part, on a debiased angular velocity of the mobile structure, the raw heading, and/or the stabilized roll and pitch; and determining a stabilized heading based, at least in part, on the raw heading and the corrected angular velocity.
 16. The method of claim 15, further comprising generating control signals for a steering actuator corresponding to a difference between a user-defined heading and the stabilized heading.
 17. The method of claim 11, wherein the determining the corrected magnetic field is additionally based on the speed and/or the angular velocity, the method further comprising: determining that external conditions corresponding to the angular velocity, the acceleration, the measured local magnetic field, and/or the speed of the mobile structure are appropriate for performing a calibration process; determining that internal conditions corresponding to a set of prior calibration points are appropriate to store a calibration point corresponding to the angular velocity, the acceleration, the measured local magnetic field, and/or the speed of the mobile structure; storing the calibration point; and determining, from the set of prior calibration points and/or the calibration point, calibration parameters to determine the corrected magnetic field.
 18. The method of claim 11, further comprising receiving user input from a user interface corresponding to a user-defined heading, and displaying the user-defined heading and/or the corrected magnetic field using the user interface.
 19. The method of claim 18, wherein the user interface is implemented within a common housing including a logic device and a magnetometer.
 20. The method of claim 11, wherein the mobile structure comprises a smart phone, a terrestrial robot, an aerial drone, a motorboat, a sailboat, an automobile, and/or an airplane. 